digraph "state transitions" {
  {{{graphAttributes}}}
  node [{{{nodeAttributes}}}]
  edge [{{{edgeAttributes}}}]

  {{> dot.states.template.hbs}}

  {{#transitions}}
  {{^noteName}}
    {{^isCompositeSelf}}
    "{{{from}}}" -> "{{{to}}}" [label="{{^label}} {{/label}}{{{label}}}"
                            {{~#fromComposite}} ltail="cluster_{{{from}}}"{{/fromComposite}}
                            {{~#toComposite}} lhead="cluster_{{{to}}}"{{/toComposite}}
                            {{~#color}} color="{{{.}}}" fontcolor="{{{.}}}"{{/color}} 
                            {{~#width}} penwidth="{{{.}}}"{{/width}} class="{{{class}}}"]
    {{/isCompositeSelf}}
    {{#isCompositeSelf}}
      "{{{from}}}" -> "self_{{{name}}}" [label="{{^label}} {{/label}}{{{label}}}" arrowhead=none 
                            {{~#tailportflags}} {{{.}}}{{/tailportflags}} ltail="cluster_{{{from}}}"
                            {{~#color}} color="{{{.}}}" fontcolor="{{{.}}}"{{/color}} class="{{{class}}}"]
      "self_{{{name}}}" -> "{{{from}}}" [lhead="cluster_{{{from}}}" 
                            {{~#headportflags}} {{{.}}}{{/headportflags}}
                            {{~#color}} color="{{{.}}}"{{/color}}
                            {{~#width}} penwidth="{{{.}}}"{{/width}} class="{{{class}}}"]
    {{/isCompositeSelf}}
  {{/noteName}}
  {{#noteName}}
      "i_{{{.}}}" [shape=point style=invis margin=0 width=0 height=0 fixedsize=true]
      "{{{../from}}}" -> "i_{{{.}}}" [arrowhead=none
                                {{~#../fromComposite}} ltail="cluster_{{{../from}}}"{{/../fromComposite}}
                                {{~#../color}} color="{{{.}}}"{{/../color}}]
      "i_{{{.}}}" -> "{{{../to}}}" [label="{{^../label}} {{/../label}}{{{../label}}}"
                                {{~#../toComposite}} lhead="cluster_{{{../to}}}"{{/../toComposite}}
                                {{~#../color}} color="{{{.}}}" fontcolor="{{{.}}}"{{/../color}}]
      "i_{{{.}}}" -> "{{{.}}}" [style=dashed arrowtail=none arrowhead=none weight=0]
      "{{{.}}}" [label="{{{../noteFlattened}}}" shape=note fontsize=10 color=black fontcolor=black fillcolor="#ffffcc" penwidth=1.0]
  {{/noteName}}
  {{/transitions}}
}
